package com.lxr.activity;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import java.util.Map;

import com.wxq.schoolmap.R;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;
/**
 * @author riddlezhang ������Ŀ������
 */
public class checkinListAdapter extends BaseAdapter {
    private static final String TAG = "SongListAdapter";
    private Context mContext;
   // private String[] strings = {"啦啦啦咯","狠狠还","jjjj","积极","嗯嗯嗯不开心"};
   // private Boolean[] yes = {true,false,false,true,true};
    public List<Map<String,Object>> list=null;
    public checkinListAdapter(Context mContext) {
        this.mContext = mContext;
    }
 
    public void setmContext(Context mContext) {
        this.mContext = mContext;
    }
    public void setmlist(List<Map<String,Object>> list2) {
        this.list=list2;
    }
    public int getCount() {
        return list.size();
    }

    public Object getItem(int position) {
        return position;
    }
 
    public long getItemId(int position) {
        return position;
    }
 
    public View getView(final int position, View convertView, ViewGroup parent) {
        convertView = LayoutInflater.from(mContext).inflate(R.layout.check_list_item, null);
        TextView checkname = (TextView) convertView.findViewById(R.id.checkname);
        TextView checkdetail = (TextView) convertView.findViewById(R.id.checkdetail);
        CheckBox check = (CheckBox) convertView.findViewById(R.id.checkBox1);
        
        checkname.setText(list.get(position).get("name").toString());
        checkdetail.setText(list.get(position).get("discription").toString());
        check.setChecked(list.get(position).get("yes").equals("1"));
        check.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener()  
        {  @Override  
            public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {  
                // TODO Auto-generated method stub  
                if(isChecked){  
                    list.get(position).put("yes", "1");
                } else{list.get(position).put("yes", "0");} 
            }

            });
        return convertView;
    }
    
}